package com.cy.sys.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.cy.common.pojo.JsonResult;
import com.cy.sys.pojo.SysMenu;
import com.cy.sys.service.SysMenuService;

/**
 * 此类处理菜单模块的请求
 * @author private
 *
 */
@RestController
@RequestMapping("/menu/")
public class SysMenuController {
	@Autowired
	private SysMenuService sysMenuService;
	
	/** 处理查询所有菜单页面 */
	@RequestMapping("doFindObjects")
	public JsonResult doFindObjects() {
		return new JsonResult(sysMenuService.findObjects());
	}
	
	/** 处理查询分级菜单回显做修改与添加 */
	@RequestMapping("doFindZtreeMenuNodes")
	public JsonResult doFindZtreeMenuNodes() {
		return new JsonResult(sysMenuService.doFindZtreeMenuNodes());
	}
	
	/** 处理添加菜单请求 */
	@RequestMapping("doSaveObject")
	public JsonResult doSaveObject(SysMenu sysMenu) {
		sysMenuService.doSaveObject(sysMenu);
		return new JsonResult("insert ok");
	}
	
	/** 处理修改菜单请求 */
	@RequestMapping("doUpdateObject")
	public JsonResult doUpdateObject(SysMenu sysMenu) {
		sysMenuService.doUpdateObject(sysMenu);
		return new JsonResult("update ok");
	}
	
	/** 处理删除菜单请求 */
	@RequestMapping("doDeleteObject")
	public JsonResult doDeleteObject(Integer id) {
		sysMenuService.doDeleteObject(id);
		return new JsonResult("delete ok");
	}
	
	
}
